package com.test.springboot.springBootUtils.jpa.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;

import com.test.springboot.springBootUtils.jpa.bean.Loacation;
import com.test.springboot.springBootUtils.jpa.dao.UserRepository;
import com.test.springboot.springBootUtils.jpa.service.JpaService;

@Service
public class JpaServiceImpl implements JpaService {
	@Autowired
	public UserRepository userRepository;

	public List<Loacation> findAll() {
		int a=8/0;
		return userRepository.findAll();
	}

	public Page<Loacation> findAllByPage() {
		return userRepository.findAll(PageRequest.of(0, 10, Sort.by("city_id")));
	}

}
